﻿#region
using System.Collections.Generic;

#endregion

namespace Y2M.Components
{
    public class ThreadSafeSet<T>
    {
        private readonly HashSet<T> _dictionary = new HashSet<T>();

        private readonly object _syncRoot = new object();

        public void Add(T url)
        {
            lock (_syncRoot)
            {
                _dictionary.Add(url);
            }
        }

        public bool Contains(T url)
        {
            lock (_syncRoot)
            {
                return _dictionary.Contains(url);
            }
        }
    }
}